package com.minyon_web_admin.controller;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import net.sf.json.JSONObject;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.minyon_utils.StringUtil;
import com.minyon_web_admin.common.base.BaseController;
import com.minyon_web_admin.common.bean.AjaxResponseBean;
import com.minyon_web_admin.model.SysMenuBean;
import com.minyon_web_admin.server.ISysMenu;
import com.minyon_web_admin.shiro.bean.LoginUser;

/**
 * 公用的操作.
 * @author WWY
 *
 */
@Controller
public class CommonController extends BaseController{
	@Autowired
	ISysMenu menuService;
	
	/**
	 * 菜单初始化.
	 * @return
	 *ajaxGetLeftMenu:
	 *AjaxResponseBean
	 */
	@RequestMapping("/ajaxGetUserMenuList.shtml")
	@ResponseBody
	public AjaxResponseBean  ajaxGetLeftMenu() {
		minYonlogger.info("初始化左侧菜单请求处理开始!");
		AjaxResponseBean result=new AjaxResponseBean();
		LoginUser currentuser = getLoginUser();
		if (StringUtil.isNotEmpty(currentuser)) {
			result.setSuccess(true);
			result.setData(currentuser.getPermissionInfo());
		}
		return result;
	}
	 @RequestMapping(value = "/error.shtml",method=RequestMethod.GET)
		public String login(Model model,HttpServletRequest request) {
			return "/error";
		}
}
